using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace IUPUI.StellarResults
{
	/// <summary>
	/// Represents a reading of an <see cref="AstronomicalObject"/> taken by an <see cref="Observatory"/>.
	/// </summary>
	[Serializable]
	[TypeConverter(typeof(ExpandableObjectConverter))]
	public class Reading : ININ.Xml.Serialization.XmlSerializationBase
	{
		#region Private Properties
		private DateTime m_DateTime;
		private Altazimuth m_CurrentAltazimuth;
		private Altazimuth m_NeededAltazimuth;
		private AstronomicalObject m_AstronomicalObject;
		private Position m_Position;
		private bool m_Visible;
		#endregion Private Properties

		#region Public Properties
		/// <summary>
		/// Gets or sets the date time the reading was taken.
		/// </summary>
		/// <value>The date time the reading was taken.</value>
		public DateTime DateTime
		{
			get
			{
				return m_DateTime;
			}
			set
			{
				m_DateTime = value;
			}
		}

		/// <summary>
		/// Gets or sets the current altazimuth of the <see cref="Observatory"/> when the reading was taken.
		/// </summary>
		/// <value>The current altazimuth of the observatory when the reading was taken.</value>
		public Altazimuth CurrentAltazimuth
		{
			get
			{
				return m_CurrentAltazimuth;
			}
			set
			{
				m_CurrentAltazimuth = value;
			}
		}

		/// <summary>
		/// Gets or sets the needed altazimuth for the <see cref="Observatory"/> to center on the <see cref="AstronomicalObject"/>.
		/// </summary>
		/// <value>The needed altazimuth for the observatory to center on the astronomical object.</value>
		public Altazimuth NeededAltazimuth
		{
			get
			{
				return m_NeededAltazimuth;
			}
			set
			{
				m_NeededAltazimuth = value;
			}
		}

		/// <summary>
		/// Gets or sets the <see cref="AstronomicalObject"/>.
		/// </summary>
		/// <value>The astronomical object.</value>
		public AstronomicalObject AstronomicalObject
		{
			get
			{
				return m_AstronomicalObject;
			}
			set
			{
				m_AstronomicalObject = value;
			}
		}

		/// <summary>
		/// Gets or sets the position of the <see cref="AstronomicalObject"/>.
		/// </summary>
		/// <value>The position of the astronomical object.</value>
		public Position Position
		{
			get
			{
				return m_Position;
			}
			set
			{
				m_Position = value;
			}
		}

		/// <summary>
		/// Gets or sets a value indicating whether the <see cref="AstronomicalObject"/> is visible to the <see cref="Observatory"/>.
		/// </summary>
		/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
		public bool Visible
		{
			get
			{
				return m_Visible;
			}
			set
			{
				m_Visible = value;
			}
		}
		#endregion Public Properties

		#region Constructors
		/// <summary>
		/// Initializes a new instance of the <see cref="Reading"/> class.
		/// </summary>
		public Reading()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Reading"/> class.
		/// </summary>
		/// <param name="dateTime">The date time when the reading was taken.</param>
		/// <param name="astronomicalObject">The astronomical object.</param>
		/// <param name="position">The position of the <see cref="AstronomicalObject"/>.</param>
		/// <param name="visible">A value indicating whether the <see cref="AstronomicalObject"/> is visible to the <see cref="Observatory"/>.</param>
		public Reading(
			DateTime dateTime,
			Altazimuth neededAltazimuth,
			AstronomicalObject astronomicalObject,
			Position position,
			bool visible)
			: this()
		{
			m_DateTime = dateTime;
			m_NeededAltazimuth = neededAltazimuth;
			m_AstronomicalObject = astronomicalObject;
			m_Position = position;
			m_Visible = visible;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Reading"/> class.
		/// </summary>
		/// <param name="dateTime">The date time when the reading was taken.</param>
		/// <param name="altazimuth">The altazimuth of the <see cref="Observatory"/> when the reading was taken.</param>
		/// <param name="astronomicalObject">The astronomical object.</param>
		/// <param name="position">The position of the <see cref="AstronomicalObject"/>.</param>
		/// <param name="visible">A value indicating whether the <see cref="AstronomicalObject"/> is visible to the <see cref="Observatory"/>.</param>
		public Reading(
			DateTime dateTime,
			Altazimuth currentAltazimuth,
			Altazimuth neededAltazimuth,
			AstronomicalObject astronomicalObject,
			Position position,
			bool visible)
			: this(dateTime, neededAltazimuth, astronomicalObject, position, visible)
		{
			m_CurrentAltazimuth = currentAltazimuth;
		}
		#endregion Constructors
	}
}
